# --------------------------------------------------------
#  Copyright (C) 2004-2020 by EMGU Corporation. All rights reserved.
# --------------------------------------------------------

IF(EMGU_CV_BUILD AND NOT APPLE)

PROJECT(Emgu.CV.UI.GL)
MESSAGE(STATUS "Configuring Emgu.CV.UI.GL")
FILE(GLOB_RECURSE SRC_CV_UI_GL RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cs")
LIST(APPEND SRC_CV_UI_GL ${CMAKE_CURRENT_SOURCE_DIR}/../CommonAssemblyInfo.cs)

GENERATE_DOCUMENT(${LIBRARY_OUTPUT_PATH}/${PROJECT_NAME})
SIGN_ASSEMBLY(${CMAKE_CURRENT_SOURCE_DIR}/../Emgu.CV.snk)

SET_CS_TARGET_FRAMEWORK(${CSC_TARGET_FRAMEWORK})
ADD_CS_REFERENCES("${LIBRARY_OUTPUT_PATH}/Emgu.CV.World.dll;${CMAKE_CURRENT_SOURCE_DIR}/OpenTK.Compatibility.dll;${CMAKE_CURRENT_SOURCE_DIR}/OpenTK.dll;${CMAKE_CURRENT_SOURCE_DIR}/OpenTK.GLControl.dll;")
ADD_CS_FRAMEWORK_REFERENCES("${CSC_TARGET_FRAMEWORK}" "System.Windows.Forms.dll")
COMPILE_CS(${PROJECT_NAME} "library" "${SRC_CV_UI_GL}" ALL)

if(ENABLE_SOLUTION_FOLDERS)
    set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "emgu")
endif()

ADD_DEPENDENCIES(${PROJECT_NAME} Emgu.CV.World)
INSTALL(
  FILES 
  ${LIBRARY_OUTPUT_PATH}/${PROJECT_NAME}.dll 
  ${LIBRARY_OUTPUT_PATH}/${PROJECT_NAME}.xml
  DESTINATION ${CPACK_PACKAGE_CLI_FOLDER}
  COMPONENT emgucv_binary)

IF(WIN32)

#IF(NETFX_CORE)
#  SET(CSPROJ_FILE "${PROJECT_NAME}.Windows.Store.csproj")
#ELSE()
  SET(CSPROJ_FILE "${PROJECT_NAME}.csproj")
#ENDIF()

INSTALL(
  DIRECTORY
  ${CMAKE_CURRENT_SOURCE_DIR}
  DESTINATION .
    COMPONENT emgucv_source
  FILES_MATCHING 
  PATTERN "*.cs"
  PATTERN "${CSPROJ_FILE}"
  PATTERN "*.resx"
  PATTERN ".svn" EXCLUDE
  PATTERN "obj" EXCLUDE
  PATTERN "CMakeFiles" EXCLUDE
  PATTERN "${PROJECT_NAME}.dir" EXCLUDE
  PATTERN "*Android*" EXCLUDE
  PATTERN "*iOS*" EXCLUDE
)
ENDIF()  

ENDIF()

